package magicboard.classifier.features
{
  import flash.geom.Point;
  
  import flexunit.framework.TestCase;
  import flexunit.framework.TestSuite;
  
  import magicboard.classifier.feature.features.SegmentCountFeature;
  import magicboard.model.InkStroke;
  
  public class SegmentsTestCase extends TestCase
  {
    // --------------------------------------------------------------------------------------------	
    public function SegmentsTestCase(methodName:String) {
   	 super( methodName );
    }

    // --------------------------------------------------------------------------------------------	
    public static function suite():TestSuite {
   			var ts:TestSuite = new TestSuite();
   			
   			ts.addTest( new SegmentsTestCase( "test1segment" ) );
   			ts.addTest( new SegmentsTestCase( "test2segments" ) );
   			return ts;
   		}

  
    // --------------------------------------------------------------------------------------------
		public function test1segment():void {

			var fe:SegmentCountFeature = new SegmentCountFeature();
			var stroke:InkStroke = new InkStroke();

			 			
			stroke.addPoint(new Point(1,1));
			stroke.addPoint(new Point(10,12));
			
			assertEquals(1, fe.extract(stroke)); 
 		}
  		
  		
    // --------------------------------------------------------------------------------------------
		public function test2segments():void {

			var fe:SegmentCountFeature = new SegmentCountFeature();
			var stroke:InkStroke = new InkStroke();

			 			
			stroke.addPoint(new Point(1,1));
			stroke.addPoint(new Point(100,120));
			stroke.addPoint(new Point(2,130));
			
			assertEquals(2, fe.extract(stroke)); 
 		}
  		
 	}
}